<div class="tab-pane " id="grid_daiyan">
    <div class="panel panel-default" role="tabpanel" style="">
        <div class="panel-heading">代言基础设置</div>
        <div class="panel-body">
            <div class="form-group">
                <label class="col-xs-12 col-sm-3 col-md-2 control-label">代言模版：</label>
                <div class="col-sm-9 col-xs-12">
                    <table class='table'>
                        <thead>
                        <tr>
                            <th>内容</th>
                            <th>操作</th>
                        </tr>
                        </thead>
                        <tbody id="yx_dy_rule_items">
                        {loop $config['yx_dy_rules'] $yx_dy_rule_item}
                        <tr style="height: 60px;">

                            <td class="col-sm-10 col-xs-12"><textarea rows="4" name="yx_dy_rule_content[]" type="text"
                                                                   class="form-control span3"
                            >{$yx_dy_rule_item['rule_content']}</textarea></td>
                            <td>
                                <input  name="yx_dy_rule_id[]" type="hidden" value="{$yx_dy_rule_id['id']}" />
                                <a href='javascript:;' onclick="removeDyRuleItem(this)"><i
                                        class='glyphicon glyphicon-remove'></i> 删除</a></td>
                        </tr>
                        {/loop}
                        </tbody>
                    </table>
                    <a href="javascript:;" onclick="addDyRule();"><i class="glyphicon glyphicon-plus" title="添加模版"></i>添加模版</a>
                </div>
            </div>
        </div>
    </div>
</div>

<script>

    function addDyRule() {
        var html = '<tr style="height: 120px;">';
        html += '<td class="col-sm-10 col-xs-12"><textarea rows="4" name="yx_dy_rule_content[]" type="text" class="form-control span3" ></textarea></td>';
        html += '<td><input  name="yx_dy_rule_id[]" type="hidden" value="" />&nbsp;<a href="javascript:;" onclick="removeDyRuleItem(this)" ><i class="glyphicon glyphicon-remove"></i> 删除</a></td>';
        html += "</tr>";
        $("#yx_dy_rule_items").append(html);
    }
    function removeDyRuleItem(obj) {
        $(obj).parent().parent().remove();
    }
</script>